package com.iscas.dataaggregation.mapper.clickhouse;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.iscas.dataaggregation.domain.experiment.OtelTraces;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.sql.Timestamp;
import java.util.List;

/**
* @author mj
* @description 针对表【otel_traces】的数据库操作Mapper
* @createDate 2024-11-24 16:13:49
* @Entity generator.domain.OtelTraces
*/
@Mapper
public interface OtelTracesMapper extends BaseMapper<OtelTraces> {
    @Select("<script>" +
            "SELECT * " +
            "FROM otel_traces " +
            "WHERE `Timestamp` BETWEEN #{from} AND #{to} " +
            "AND `ServiceName` LIKE CONCAT('/k8s/', #{namespace}, '/%')" +
            "</script>")
    List<OtelTraces> findTracesByTimeAndNamespace(@Param("from") Timestamp from,
                                                  @Param("to") Timestamp to,
                                                  @Param("namespace") String namespace);
}




